home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 26 (Anniversary Edition)
/
Volume 26 [Anniversary Edition] - JOGO DISK .iso
/
Fight
/
battleinmegaville.swf
/
scripts
/
frame_2013
/
DoAction.as
Wrap
Text File
|
2006-09-05
|
79KB
|
2,314 lines
§§pop();
§§pop();
spriteIndex = 0;
while(spriteIndex < _spriteInstances)
{
if(_gameover && sprite[spriteIndex]._state != STATE_COMBO1 && sprite[spriteIndex]._state != STATE_COMBO2 || _gameMode == MODE_TUTORIAL && spriteIndex == 1)
{
onLeft = false;
onRight = false;
onUp = false;
onDown = false;
onA = false;
onB = false;
newLeft = false;
newRight = false;
newUp = false;
newDown = false;
newA = false;
newB = false;
keyCombo[spriteIndex] = null;
}
if(_numPlayers > 1 && !sprite[1]._deflect && (sprite[1]._state == STATE_IDLE || sprite[1]._state == STATE_RUN))
{
sprite[1]._deflect = !keyWasDown[1][KEYINDEX_B] && Key.isDown(keyCode[1][KEYINDEX_B]);
if(sprite[1]._deflect)
{
sprite[1]._deflectwait = true;
}
}
if(spriteIndex < _numPlayers && (!_gameover || sprite[spriteIndex]._state == STATE_COMBO1 || sprite[spriteIndex]._state == STATE_COMBO2))
{
k = 0;
while(k < KEYSPERPLAYER)
{
if(!keyWasDown[spriteIndex][k] && Key.isDown(keyCode[spriteIndex][k]))
{
updateKeyCombo(spriteIndex,k);
}
else if(_numPlayers == 1 && _singlePlayerDualControlsEnabled && !keyWasDown[spriteIndex][k] && Key.isDown(keyCode[spriteIndex + 1][k]))
{
updateKeyCombo(spriteIndex,k);
}
k++;
}
updateKeyCombo(spriteIndex,null);
onLeft = Key.isDown(keyCode[spriteIndex][KEYINDEX_LEFT]);
onRight = Key.isDown(keyCode[spriteIndex][KEYINDEX_RIGHT]);
onUp = Key.isDown(keyCode[spriteIndex][KEYINDEX_UP]);
onDown = Key.isDown(keyCode[spriteIndex][KEYINDEX_DOWN]);
onA = Key.isDown(keyCode[spriteIndex][KEYINDEX_A]);
onB = Key.isDown(keyCode[spriteIndex][KEYINDEX_B]);
if(_numPlayers == 1 && _singlePlayerDualControlsEnabled)
{
onLeft = onLeft || Key.isDown(keyCode[1][KEYINDEX_LEFT]);
onRight = onRight || Key.isDown(keyCode[1][KEYINDEX_RIGHT]);
onUp = onUp || Key.isDown(keyCode[1][KEYINDEX_UP]);
onDown = onDown || Key.isDown(keyCode[1][KEYINDEX_DOWN]);
onA = onA || Key.isDown(keyCode[1][KEYINDEX_A]);
onB = onB || Key.isDown(keyCode[1][KEYINDEX_B]);
}
newLeft = !keyWasDown[spriteIndex][KEYINDEX_LEFT] && onLeft;
newRight = !keyWasDown[spriteIndex][KEYINDEX_RIGHT] && onRight;
newUp = !keyWasDown[spriteIndex][KEYINDEX_UP] && onUp;
newDown = !keyWasDown[spriteIndex][KEYINDEX_DOWN] && onDown;
newA = !keyWasDown[spriteIndex][KEYINDEX_A] && onA;
newB = !keyWasDown[spriteIndex][KEYINDEX_B] && onB;
keyWasDown[spriteIndex][KEYINDEX_LEFT] = onLeft;
keyWasDown[spriteIndex][KEYINDEX_RIGHT] = onRight;
keyWasDown[spriteIndex][KEYINDEX_UP] = onUp;
keyWasDown[spriteIndex][KEYINDEX_DOWN] = onDown;
keyWasDown[spriteIndex][KEYINDEX_A] = onA;
keyWasDown[spriteIndex][KEYINDEX_B] = onB;
keyWasDown[spriteIndex][KEYINDEX_L] = onL;
keyWasDown[spriteIndex][KEYINDEX_R] = onR;
if(spriteIndex == 0)
{
if(!sprite[spriteIndex]._deflect && (sprite[spriteIndex]._state == STATE_IDLE || sprite[spriteIndex]._state == STATE_RUN))
{
sprite[spriteIndex]._deflect = newB;
if(sprite[spriteIndex]._deflect)
{
sprite[spriteIndex]._deflectwait = true;
}
}
}
}
thisSprite = sprite[spriteIndex];
thisName = spriteName[spriteIndex];
faceLeft = thisSprite._xscale > 0;
ai = spriteIndex >= _numPlayers && _gameMode != MODE_TUTORIAL;
otherai = (_numPlayers == 0 || _numPlayers == 1 && spriteIndex == 0) && _gameMode != MODE_TUTORIAL;
otherSprite = sprite[1 - spriteIndex];
otherIndex = 1 - spriteIndex;
otherName = spriteName[1 - spriteIndex];
aiRun();
if(!onDown && thisSprite._state == STATE_SHIELD)
{
thisSprite._state = STATE_IDLE;
if(!thisSprite._airborne)
{
thisSprite.gotoAndPlay("idle");
}
else
{
thisSprite.gotoAndPlay("fall");
}
}
else if(thisSprite._state == STATE_COMBO1)
{
if(thisSprite._stateDone)
{
bufferedCombo2[spriteIndex] = false;
bufferedCombo3[spriteIndex] = false;
thisSprite._state = STATE_IDLE;
thisSprite._stateDone = false;
thisSprite._comboDone = false;
thisSprite._weakHit = false;
}
else if(thisSprite._comboDone)
{
if(bufferedCombo2[spriteIndex] == KEYINDEX_A)
{
bufferedCombo2[spriteIndex] = false;
thisSprite._state = STATE_COMBO2B;
thisSprite._stateDone = false;
thisSprite._comboDone = false;
thisSprite._weakHit = false;
thisSprite.gotoAndPlay("upper");
thisSprite._ai_aerial = 0;
damageDone[spriteIndex][otherIndex] = false;
if(thisName == NAME_BLOSSOM)
{
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_LEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_RIGHT;
}
thisSprite._atkdirY = ATKDIR_JUGGLE;
thisSprite._damage = 6;
}
else if(thisName == NAME_BUBBLES)
{
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_LEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_RIGHT;
}
thisSprite._atkdirY = ATKDIR_UP;
thisSprite._damage = 8;
}
else if(thisName == NAME_BUTTERCUP)
{
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_NONELEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_NONERIGHT;
}
thisSprite._atkdirY = ATKDIR_JUGGLE;
thisSprite._damage = 6;
}
else if(thisName == NAME_BELL || thisName == NAME_SHIRABELL)
{
thisSprite._atkdirX = ATKDIR_VACUUM;
thisSprite._atkdirY = ATKDIR_NONE;
thisSprite._damage = 2;
}
else if(thisName == NAME_DEXTER)
{
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_NONELEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_NONERIGHT;
}
thisSprite._atkdirY = ATKDIR_JUGGLE;
thisSprite._damage = 10;
}
else if(thisName == NAME_ROWDY)
{
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_NONELEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_NONERIGHT;
}
thisSprite._atkdirY = ATKDIR_JUGGLE;
thisSprite._damage = 5;
}
}
else if(bufferedCombo2[spriteIndex] == KEYINDEX_B)
{
bufferedCombo2[spriteIndex] = false;
thisSprite._state = STATE_COMBO2;
thisSprite._stateDone = false;
thisSprite._comboDone = false;
thisSprite._weakHit = false;
thisSprite.gotoAndPlay("combo2");
damageDone[spriteIndex][otherIndex] = false;
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_NONELEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_NONERIGHT;
}
thisSprite._atkdirY = ATKDIR_NONE;
if(thisName == NAME_BUTTERCUP)
{
thisSprite._atkdirY = ATKDIR_UP;
}
thisSprite._damage = 2;
if(thisName == NAME_DEXTER)
{
thisSprite._damage = 3;
}
}
}
}
else if(thisSprite._state == STATE_COMBO2)
{
if(thisSprite._stateDone)
{
bufferedCombo3[spriteIndex] = false;
thisSprite._state = STATE_IDLE;
thisSprite._stateDone = false;
thisSprite._comboDone = false;
thisSprite._weakHit = false;
}
else if(thisSprite._comboDone)
{
if(bufferedCombo3[spriteIndex] == KEYINDEX_A)
{
bufferedCombo3[spriteIndex] = false;
thisSprite._state = STATE_COMBO3B;
thisSprite._stateDone = false;
thisSprite._comboDone = false;
thisSprite._weakHit = false;
thisSprite.gotoAndPlay("combo3u");
damageDone[spriteIndex][otherIndex] = false;
if(thisName == NAME_BLOSSOM)
{
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_LEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_RIGHT;
}
thisSprite._atkdirY = ATKDIR_UP;
thisSprite._damage = 10;
}
else if(thisName == NAME_BUBBLES)
{
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_NONELEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_NONERIGHT;
}
thisSprite._atkdirY = ATKDIR_JUGGLE;
thisSprite._damage = 5;
}
else if(thisName == NAME_BUTTERCUP)
{
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_LEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_RIGHT;
}
thisSprite._atkdirY = ATKDIR_DOWN;
thisSprite._damage = 7;
}
else if(thisName == NAME_BELL || thisName == NAME_SHIRABELL)
{
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_NONELEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_NONERIGHT;
}
thisSprite._atkdirY = ATKDIR_JUGGLE;
thisSprite._damage = 6;
}
else if(thisName == NAME_DEXTER)
{
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_LEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_RIGHT;
}
thisSprite._atkdirY = ATKDIR_UP;
thisSprite._damage = 14;
}
else if(thisName == NAME_ROWDY)
{
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_NONELEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_NONERIGHT;
}
thisSprite._atkdirY = ATKDIR_NONE;
thisSprite._damage = 1;
}
}
else if(bufferedCombo3[spriteIndex] == KEYINDEX_B)
{
bufferedCombo3[spriteIndex] = false;
thisSprite._state = STATE_COMBO3;
thisSprite._stateDone = false;
thisSprite._comboDone = false;
thisSprite._weakHit = false;
thisSprite.gotoAndPlay("combo3");
if(thisSprite._yspd < -5)
{
thisSprite._yspd = -5;
}
damageDone[spriteIndex][otherIndex] = false;
if(thisName == NAME_BLOSSOM)
{
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_LEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_RIGHT;
}
thisSprite._atkdirY = ATKDIR_NONE;
thisSprite._damage = 7;
}
else if(thisName == NAME_BUBBLES)
{
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_LEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_RIGHT;
}
thisSprite._atkdirY = ATKDIR_UP;
thisSprite._damage = 12;
}
else if(thisName == NAME_BUTTERCUP)
{
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_LEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_RIGHT;
}
thisSprite._atkdirY = ATKDIR_BOUNCE;
thisSprite._damage = 8;
tempyspd = -50;
thisSprite._airborne = true;
}
else if(thisName == NAME_BELL || thisName == NAME_SHIRABELL)
{
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_LEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_RIGHT;
}
thisSprite._atkdirY = ATKDIR_UP;
thisSprite._damage = 4;
}
else if(thisName == NAME_DEXTER)
{
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_NONELEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_NONERIGHT;
}
thisSprite._atkdirY = ATKDIR_NONE;
thisSprite._damage = 24;
}
else if(thisName == NAME_ROWDY)
{
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_LEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_RIGHT;
}
thisSprite._atkdirY = ATKDIR_NONE;
thisSprite._damage = 12;
}
}
}
}
else if(thisSprite._state == STATE_COMBO2B)
{
if(thisSprite._stateDone)
{
thisSprite._state = STATE_IDLE;
thisSprite._stateDone = false;
thisSprite._comboDone = false;
thisSprite._weakHit = false;
}
}
else if(thisSprite._state == STATE_COMBO3)
{
if(thisSprite._stateDone)
{
thisSprite._state = STATE_IDLE;
thisSprite._stateDone = false;
thisSprite._comboDone = false;
thisSprite._weakHit = false;
}
}
else if(thisSprite._state == STATE_COMBO3B)
{
if(thisSprite._stateDone)
{
thisSprite._state = STATE_IDLE;
thisSprite._stateDone = false;
thisSprite._comboDone = false;
thisSprite._weakHit = false;
}
}
else if(thisSprite._state == STATE_RANGED)
{
if(thisSprite._hitDone)
{
if(thisName == NAME_BUBBLES)
{
thisSprite._hitDone = false;
if(faceLeft)
{
thisSprite.projectile._x = thisSprite._x - 20;
thisSprite.projectile._xscale = 100;
}
else
{
thisSprite.projectile._x = thisSprite._x + 20;
thisSprite.projectile._xscale = -100;
}
thisSprite.projectile._yspd = 0;
thisSprite.projectile._y = thisSprite._y;
thisSprite.projectile._visible = true;
thisSprite.projectile._hitDone = false;
}
else if(thisName == NAME_ROWDY)
{
thisSprite._hitDone = false;
if(faceLeft)
{
thisSprite.projectile._x = thisSprite._x + 140;
thisSprite.projectile._xscale = 100;
}
else
{
thisSprite.projectile._x = thisSprite._x - 140;
thisSprite.projectile._xscale = -100;
}
thisSprite.projectile._y = 204 + terrain._y + 245;
thisSprite.projectile._visible = true;
thisSprite.projectile._hitDone = false;
thisSprite.projectile.gotoAndPlay("boomer");
}
}
if(thisSprite._stateDone)
{
thisSprite._state = STATE_IDLE;
thisSprite._stateDone = false;
thisSprite._weakHit = false;
}
}
else if(thisSprite._state == STATE_AIRRANGED2)
{
if(thisSprite._stateDone)
{
thisSprite._state = STATE_IDLE;
thisSprite._stateDone = false;
thisSprite.gotoAndPlay("idle");
thisSprite._weakHit = false;
}
}
else if(thisSprite._state == STATE_AIRRANGED)
{
if(thisSprite._hitDone)
{
if(thisName == NAME_DEXTER)
{
thisSprite._hitDone = false;
thisSprite._state = STATE_AIRRANGED2;
}
else if(thisName == NAME_BUBBLES)
{
thisSprite._hitDone = false;
if(faceLeft)
{
thisSprite.projectile._x = thisSprite._x - 20;
thisSprite.projectile._xscale = 100;
}
else
{
thisSprite.projectile._x = thisSprite._x + 20;
thisSprite.projectile._xscale = -100;
}
thisSprite.projectile._yspd = 5;
thisSprite.projectile._y = thisSprite._y;
thisSprite.projectile._visible = true;
thisSprite.projectile._hitDone = false;
if(thisSprite.projectile._fast)
{
thisSprite.projectile._yspd *= 2;
}
}
else if(thisName == NAME_ROWDY)
{
thisSprite._hitDone = false;
thisSprite.projectile._x = thisSprite._x;
if(faceLeft)
{
thisSprite.projectile._xscale = 100;
}
else
{
thisSprite.projectile._xscale = -100;
}
thisSprite.projectile._y = 200 + terrain._y + 245;
thisSprite.projectile._visible = true;
thisSprite.projectile._hitDone = false;
thisSprite.projectile.gotoAndPlay("butch");
}
}
if(thisSprite._stateDone)
{
thisSprite._state = STATE_IDLE;
thisSprite._stateDone = false;
if(!thisSprite._airborne)
{
thisSprite.gotoAndPlay("idle");
}
thisSprite._weakHit = false;
}
else if(thisName == NAME_BELL || thisName == NAME_SHIRABELL)
{
if(!thisSprite._airborne)
{
thisSprite._state = STATE_AIRRANGED2;
thisSprite.gotoAndPlay("land");
}
}
}
else if(thisSprite._state == STATE_DOWNATK)
{
if(thisSprite._stateDone)
{
thisSprite._state = STATE_IDLE;
thisSprite._stateDone = false;
if(!thisSprite._airborne)
{
thisSprite.gotoAndPlay("idle");
}
thisSprite._weakHit = false;
}
}
else if(thisSprite._state == STATE_RECOVER)
{
if(thisSprite._stateDone)
{
thisSprite._state = STATE_IDLE;
thisSprite._stateDone = false;
}
}
else if(thisSprite._state == STATE_FROZEN)
{
if(thisSprite._stateDone)
{
thisSprite._state = STATE_IDLE;
thisSprite._stateDone = false;
sprite[0].combo.num = 0;
sprite[1].combo.num = 0;
}
}
if(thisSprite._state == STATE_FALLEN && thisSprite._fallTime-- <= 0 && thisSprite._hp > MIN_HP)
{
bufferedUp[spriteIndex] = false;
bufferedLeft[spriteIndex] = false;
bufferedRight[spriteIndex] = false;
thisSprite.gotoAndPlay("recover");
thisSprite._stateDone = false;
thisSprite._state = STATE_RECOVER;
thisSprite._juggles = 0;
sprite[0].combo.num = 0;
sprite[1].combo.num = 0;
}
else if((keyCombo[spriteIndex] == KEYINDEX_LEFT && newLeft || keyCombo[spriteIndex] == KEYINDEX_RIGHT && newRight) && !thisSprite._dashed && thisSprite._dashes >= 100 && thisName != NAME_ZIM && (thisName != NAME_DEXTER || !thisSprite._airborne) && (thisSprite._state == STATE_RUN || thisSprite._state == STATE_IDLE || thisSprite._state == STATE_SHIELD || thisSprite._state == STATE_SHIELDDAMAGE || thisSprite._state == STATE_RECOVER))
{
thisSprite._state = STATE_DASH;
sprite[spriteIndex]._invincible = true;
thisSprite._dashFuel = SPRITE_MAXDASHFUEL[spriteIndex];
thisSprite.gotoAndPlay("dash");
thisSprite._dashed = true;
thisSprite._dashes -= 100;
if(keyCombo[spriteIndex] == KEYINDEX_LEFT && !faceLeft || keyCombo[spriteIndex] == KEYINDEX_RIGHT && faceLeft)
{
thisSprite._xscale *= -1;
faceLeft = !faceLeft;
}
clearKeyCombo(spriteIndex);
}
else if(onDown && (thisSprite._state == STATE_RUN || thisSprite._state == STATE_IDLE))
{
thisSprite._state = STATE_SHIELD;
thisSprite.gotoAndPlay("shield");
if(thisSprite._yspd < -5)
{
thisSprite._yspd = -5;
}
}
else if((newA || newB) && (thisSprite._state == STATE_RUN || thisSprite._state == STATE_IDLE))
{
if(thisSprite._airborne)
{
if(newA)
{
if((thisName == NAME_BUBBLES || thisName == NAME_ROWDY) && !thisSprite.projectile._visible && !thisSprite._hovered || thisName == NAME_BUTTERCUP && !thisSprite._hovered || thisName == NAME_BLOSSOM || thisName == NAME_DEXTER || thisName == NAME_BELL || thisName == NAME_SHIRABELL)
{
if(thisName == NAME_BUTTERCUP)
{
thisSprite._hovered = true;
}
thisSprite._state = STATE_AIRRANGED;
thisSprite._stateDone = false;
if(thisName == NAME_DEXTER)
{
thisSprite.gotoAndPlay("combo3");
}
else if(thisName == NAME_ROWDY)
{
thisSprite.gotoAndPlay("ranged");
}
else
{
thisSprite.gotoAndPlay("airranged");
}
if(thisSprite._yspd < 0)
{
thisSprite._yspd = 0;
}
damageDone[spriteIndex][otherIndex] = false;
thisSprite.projectile._fast = onLeft || onRight;
if(onLeft && !faceLeft || onRight && faceLeft)
{
thisSprite._xscale *= -1;
faceLeft = !faceLeft;
}
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_LEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_RIGHT;
}
thisSprite._atkdirY = ATKDIR_NONE;
if(thisName == NAME_BLOSSOM)
{
thisSprite._damage = 5;
}
else if(thisName == NAME_BUBBLES)
{
thisSprite._damage = 0;
thisSprite.projectile._damage = 3;
thisSprite._hovered = true;
}
else if(thisName == NAME_ROWDY)
{
thisSprite._damage = 0;
thisSprite.projectile._damage = BUTCH_DAMAGE;
thisSprite._hovered = true;
}
else if(thisName == NAME_BUTTERCUP)
{
thisSprite._damage = 7;
}
else if(thisName == NAME_BELL || thisName == NAME_SHIRABELL)
{
thisSprite._atkdirY = ATKDIR_UP;
thisSprite._damage = 10;
thisSprite._dashFuel = 5;
}
else if(thisName == NAME_DEXTER)
{
thisSprite._atkdirY = ATKDIR_DOWN;
thisSprite._damage = 12;
}
}
}
else if(!thisSprite._hovered)
{
thisSprite._hovered = true;
thisSprite._state = STATE_DOWNATK;
thisSprite._stateDone = false;
thisSprite.gotoAndPlay("downatk");
if(thisSprite._yspd < 0)
{
thisSprite._yspd = 0;
}
damageDone[spriteIndex][otherIndex] = false;
if(onLeft && !faceLeft || onRight && faceLeft)
{
thisSprite._xscale *= -1;
faceLeft = !faceLeft;
}
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_LEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_RIGHT;
}
thisSprite._atkdirY = ATKDIR_NONE;
thisSprite._damage = 7;
if(thisName == NAME_DEXTER)
{
thisSprite._damage = 8;
}
}
}
else if(newA)
{
if(thisName != NAME_BUBBLES && thisName != NAME_ROWDY || !thisSprite.projectile._visible)
{
thisSprite._state = STATE_RANGED;
thisSprite._stateDone = false;
thisSprite._stateChange = false;
thisSprite.gotoAndPlay("ranged");
damageDone[spriteIndex][otherIndex] = false;
thisSprite.projectile._fast = onLeft || onRight;
if(onLeft && !faceLeft || onRight && faceLeft)
{
thisSprite._xscale *= -1;
faceLeft = !faceLeft;
}
if(thisName == NAME_BLOSSOM)
{
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_LEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_RIGHT;
}
thisSprite._atkdirY = ATKDIR_NONE;
thisSprite._damage = 5;
}
else if(thisName == NAME_BUBBLES)
{
thisSprite._damage = 0;
thisSprite.projectile._damage = 3;
}
else if(thisName == NAME_ROWDY)
{
thisSprite._damage = 0;
thisSprite.projectile._damage = BOOMER_DAMAGE;
}
else if(thisName == NAME_BUTTERCUP)
{
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_LEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_RIGHT;
}
thisSprite._atkdirY = ATKDIR_NONE;
thisSprite._damage = 6;
}
else if(thisName == NAME_BELL || thisName == NAME_SHIRABELL)
{
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_LEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_RIGHT;
}
thisSprite._atkdirY = ATKDIR_NONE;
thisSprite._damage = 6;
}
else if(thisName == NAME_DEXTER)
{
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_LEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_RIGHT;
}
thisSprite._atkdirY = ATKDIR_NONE;
thisSprite._damage = 6;
}
}
}
else if(!thisSprite._deflected)
{
thisSprite._state = STATE_COMBO1;
thisSprite._stateDone = false;
thisSprite.gotoAndPlay("combo1");
bufferedCombo2[spriteIndex] = false;
bufferedCombo3[spriteIndex] = false;
if(thisSprite._yspd < 0)
{
thisSprite._yspd = 0;
}
damageDone[spriteIndex][otherIndex] = false;
if(onLeft && !faceLeft || onRight && faceLeft)
{
thisSprite._xscale *= -1;
faceLeft = !faceLeft;
}
if(faceLeft)
{
thisSprite._atkdirX = ATKDIR_NONELEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_NONERIGHT;
}
thisSprite._atkdirY = ATKDIR_NONE;
thisSprite._damage = 4;
if(thisName == NAME_DEXTER)
{
thisSprite._damage = 5;
}
}
}
else if((newA || newB) && !ai && thisSprite._state == STATE_COMBO1)
{
if(!bufferedCombo2[spriteIndex])
{
if(newA)
{
bufferedCombo2[spriteIndex] = KEYINDEX_A;
}
else
{
bufferedCombo2[spriteIndex] = KEYINDEX_B;
}
}
else if(!bufferedCombo3[spriteIndex])
{
if(newA)
{
bufferedCombo3[spriteIndex] = KEYINDEX_A;
}
else
{
bufferedCombo3[spriteIndex] = KEYINDEX_B;
}
}
}
else if((newA || newB) && !ai && thisSprite._state == STATE_COMBO2)
{
if(!bufferedCombo3[spriteIndex])
{
if(newA)
{
bufferedCombo3[spriteIndex] = KEYINDEX_A;
}
else
{
bufferedCombo3[spriteIndex] = KEYINDEX_B;
}
}
}
else if((onLeft || onRight) && (thisName != NAME_ZIM || thisSprite._dashes > 2))
{
if(thisName != NAME_ZIM || _numPlayers == 1 || thisName == NAME_ZIM && _numPlayers > 1 && (thisSprite._dashes > 200 || thisSprite._state == STATE_RUN && thisSprite._dashes > 2))
{
if(onLeft && onRight)
{
onRight = false;
}
if(thisSprite._state == STATE_IDLE)
{
if(!thisSprite._airborne)
{
thisSprite.gotoAndPlay("forward");
}
thisSprite._state = STATE_RUN;
}
if(thisSprite._state == STATE_RUN)
{
if(thisName == NAME_ZIM && _numPlayers > 1)
{
thisSprite._dashes -= 6;
}
if(onLeft && !faceLeft || onRight && faceLeft)
{
thisSprite._xscale *= -1;
faceLeft = !faceLeft;
}
}
}
}
else if(thisSprite._state == STATE_RUN)
{
if(!thisSprite._airborne)
{
thisSprite.gotoAndPlay("idle");
}
thisSprite._state = STATE_IDLE;
}
if(thisSprite._state == STATE_SHIELD)
{
if(onLeft && !faceLeft || onRight && faceLeft)
{
thisSprite._xscale *= -1;
faceLeft = !faceLeft;
}
}
if(thisSprite._state == STATE_IDLE || thisSprite._state == STATE_RUN)
{
if(newUp && thisSprite._yspd == 0 && !thisSprite._airborne && !thisSprite._jumpDelay && thisName != NAME_ZIM)
{
thisSprite._yspd = - SPRITE_JUMPSPEED[thisName];
thisSprite.gotoAndPlay("jump");
thisSprite._airborne = true;
}
else if(newUp && thisSprite._yspd != 0 && !thisSprite._doubleJumped && thisSprite._airborne)
{
thisSprite._yspd = - SPRITE_JUMPSPEED[thisName] + 5;
thisSprite.gotoAndPlay("teleport");
thisSprite._doubleJumped = true;
clearKeyCombo(spriteIndex);
}
else if(!onUp && thisSprite._yspd < 0)
{
thisSprite._yspd = 0;
thisSprite.gotoAndPlay("fall");
}
}
thisSprite._xspd = 0;
if(thisSprite._state == STATE_DASH)
{
if(thisSprite._dashFuel > 0)
{
if(onB)
{
if(faceLeft)
{
thisSprite._xspd += - SPRITE_RUNSPEED[thisName];
}
else
{
thisSprite._xspd += SPRITE_RUNSPEED[thisName];
}
}
else if(faceLeft)
{
thisSprite._xspd += (- SPRITE_RUNSPEED[thisName]) * 2;
}
else
{
thisSprite._xspd += SPRITE_RUNSPEED[thisName] * 2;
}
thisSprite._dashFuel--;
}
else
{
thisSprite._state = STATE_RUN;
if(!thisSprite._airborne)
{
thisSprite.gotoAndPlay("forward");
}
else
{
thisSprite.gotoAndPlay("fall");
}
}
}
else if(thisSprite._state == STATE_RUN)
{
if(faceLeft)
{
thisSprite._xspd += - SPRITE_RUNSPEED[thisName];
}
else
{
thisSprite._xspd += SPRITE_RUNSPEED[thisName];
}
}
thisSprite._yspd = thisSprite._yspd + 1;
if(thisSprite._yspd == 0)
{
thisSprite._yspd = 1;
}
if(thisSprite._yspd > SPRITE_MAXFALLSPEED[thisName])
{
thisSprite._yspd = SPRITE_MAXFALLSPEED[thisName];
}
if(thisSprite._state == STATE_DASH)
{
thisSprite._yspd = 0;
}
else if(thisSprite._state == STATE_COMBO2B)
{
if(thisName == NAME_BLOSSOM)
{
if(thisSprite._stateChange)
{
thisSprite._stateChange = false;
thisSprite._yspd = -16;
thisSprite._airborne = true;
}
if(thisSprite._airborne)
{
if(faceLeft)
{
thisSprite._xspd -= 5;
}
else
{
thisSprite._xspd += 5;
}
}
}
else if(thisName == NAME_BUBBLES)
{
if(thisSprite._stateChange)
{
thisSprite._stateChange = false;
thisSprite._yspd = -15;
thisSprite._airborne = true;
}
if(thisSprite._airborne)
{
if(faceLeft)
{
thisSprite._xspd -= 5;
}
else
{
thisSprite._xspd += 5;
}
}
}
else if(thisName == NAME_BUTTERCUP)
{
if(faceLeft)
{
thisSprite._xspd -= 1;
}
else
{
thisSprite._xspd += 1;
}
if(thisSprite._stateChange)
{
thisSprite._stateChange = false;
thisSprite._yspd = -12;
thisSprite._airborne = true;
}
}
}
else if(thisSprite._state == STATE_COMBO3B)
{
if(thisName == NAME_BLOSSOM)
{
if(thisSprite._stateChange)
{
thisSprite._stateChange = false;
thisSprite._yspd = -10;
thisSprite._airborne = true;
}
if(thisSprite._airborne)
{
if(faceLeft)
{
thisSprite._xspd -= 15;
}
else
{
thisSprite._xspd += 15;
}
}
}
else if(thisName == NAME_BELL || thisName == NAME_SHIRABELL)
{
if(faceLeft)
{
thisSprite._xspd -= 3;
}
else
{
thisSprite._xspd += 3;
}
if(thisSprite._stateChange)
{
thisSprite._stateChange = false;
thisSprite._yspd = -10;
if(thisName == NAME_SHIRABELL)
{
thisSprite._yspd = -5;
}
thisSprite._airborne = true;
}
}
else if(thisName == NAME_ROWDY)
{
if(thisSprite._stateChange)
{
thisSprite._stateChange = false;
thisSprite._yspd = -6;
if(thisSprite._damage <= 1)
{
thisSprite._damage = thisSprite._damage + 1;
}
else
{
thisSprite._atkdirY = ATKDIR_JUGGLE;
}
thisSprite._airborne = true;
}
if(thisSprite._airborne)
{
if(faceLeft)
{
thisSprite._xspd -= 1;
}
else
{
thisSprite._xspd += 1;
}
}
}
}
else if(thisSprite._state == STATE_COMBO3)
{
if(thisName == NAME_BUTTERCUP)
{
if(faceLeft)
{
thisSprite._xspd -= 15;
}
else
{
thisSprite._xspd += 15;
}
if(thisSprite._airborne)
{
thisSprite._yspd = 0;
}
}
else if(thisName == NAME_BELL || thisName == NAME_SHIRABELL)
{
if(faceLeft)
{
thisSprite._xspd -= 1;
}
else
{
thisSprite._xspd += 1;
}
if(thisSprite._weakhit)
{
thisSprite._yspd = -1;
thisSprite._airborne = true;
}
}
else if(thisName == NAME_DEXTER)
{
if(thisSprite._stateChange)
{
thisSprite._stateChange = false;
if(faceLeft)
{
thisSprite._xspd -= 16;
}
else
{
thisSprite._xspd += 16;
}
}
}
else if(thisName == NAME_ROWDY)
{
if(thisSprite._stateChange)
{
thisSprite._stateChange = false;
if(faceLeft)
{
thisSprite._xspd -= 8;
}
else
{
thisSprite._xspd += 8;
}
}
}
}
else if(thisSprite._state == STATE_DOWNATK)
{
thisSprite._yspd = 1;
}
else if(thisSprite._state == STATE_RANGED)
{
if(thisName == NAME_DEXTER)
{
if(thisSprite._stateChange)
{
thisSprite._stateChange = false;
if(thisSprite._atkdirX == ATKDIR_RIGHT)
{
thisSprite._atkdirX = ATKDIR_LEFT;
}
else
{
thisSprite._atkdirX = ATKDIR_RIGHT;
}
}
}
}
else if(thisSprite._state == STATE_AIRRANGED)
{
if(thisName == NAME_BLOSSOM)
{
thisSprite._yspd = 2;
if(faceLeft)
{
thisSprite._xspd = thisSprite._xspd + 1;
}
else
{
thisSprite._xspd--;
}
}
else if(thisName == NAME_BUBBLES)
{
thisSprite._yspd = 2;
if(faceLeft)
{
thisSprite._xspd = thisSprite._xspd + 1;
}
else
{
thisSprite._xspd--;
}
}
else if(thisName == NAME_BUTTERCUP)
{
thisSprite._yspd = 1;
if(thisSprite._stateChange)
{
if(faceLeft)
{
thisSprite._xspd -= 14;
}
else
{
thisSprite._xspd += 14;
}
}
else if(faceLeft)
{
thisSprite._xspd += 5;
}
else
{
thisSprite._xspd -= 5;
}
}
else if(thisName == NAME_BELL || thisName == NAME_SHIRABELL)
{
if(thisSprite._dashFuel <= 0)
{
thisSprite._yspd = 12;
if(faceLeft)
{
thisSprite._xspd -= 12;
}
else
{
thisSprite._xspd += 12;
}
}
else
{
thisSprite._yspd = 0;
thisSprite._dashFuel--;
}
}
else if(thisName == NAME_DEXTER)
{
if(thisSprite._yspd < -5)
{
thisSprite._yspd = -5;
}
}
}
if(thisSprite._x + thisSprite._xspd < 10)
{
thisSprite._xspd = 10 - thisSprite._x;
}
if(thisSprite._x + thisSprite._xspd > 390)
{
thisSprite._xspd = 390 - thisSprite._x;
}
if(thisSprite._state == STATE_SHIELDDAMAGE)
{
if(thisSprite._atkdirX != ATKDIR_VACUUM)
{
if(thisSprite._atkdirX == ATKDIR_LEFT || thisSprite._atkdirX == ATKDIR_NONELEFT || thisSprite._atkdirX == ATKDIR_BACK && !faceLeft)
{
thisSprite._xspd += -1;
}
else
{
thisSprite._xspd += 1;
}
}
if(thisSprite._airborne)
{
if(thisSprite._yspd > 2)
{
thisSprite._yspd = 2;
}
}
}
else if(thisSprite._state == STATE_DAMAGE)
{
if(thisSprite._atkdirX == ATKDIR_VACUUM)
{
if(thisSprite._x != sprite[1 - spriteIndex]._x)
{
if(thisSprite._x > sprite[1 - spriteIndex]._x)
{
thisSprite._xspd += -1;
}
else
{
thisSprite._xspd += 1;
}
}
}
else if(thisSprite._atkdirX == ATKDIR_NONELEFT)
{
thisSprite._xspd += -1;
}
else if(thisSprite._atkdirX == ATKDIR_NONERIGHT)
{
thisSprite._xspd += 1;
}
else if((thisSprite._atkdirX == ATKDIR_LEFT || thisSprite._atkdirX == ATKDIR_RIGHT || thisSprite._atkdirX == ATKDIR_BACK) && thisSprite._dashFuel > 0)
{
if(thisSprite._atkdirX == ATKDIR_LEFT || thisSprite._atkdirX == ATKDIR_BACK && !faceLeft)
{
thisSprite._xspd += - Math.round(thisSprite._dashFuel);
}
else
{
thisSprite._xspd += Math.round(thisSprite._dashFuel);
}
if(!thisSprite._airborne)
{
thisSprite._dashFuel--;
}
else
{
thisSprite._dashFuel -= 0.3;
}
}
}
thisSprite._yspd += tempyspd;
wasAirborne = thisSprite._airborne;
collision(thisSprite);
if(!thisSprite._airborne)
{
if(wasAirborne)
{
if(thisSprite._state == STATE_IDLE)
{
thisSprite.gotoAndPlay("idle");
}
else if(thisSprite._state == STATE_RUN)
{
thisSprite.gotoAndPlay("forward");
}
thisSprite._doubleJumped = false;
thisSprite._jumpDelay = MAX_JUMPDELAY;
}
if(thisSprite._jumpDelay > 0)
{
thisSprite._jumpDelay--;
}
thisSprite._dashed = false;
thisSprite._hovered = false;
}
if(thisSprite._state == STATE_SHIELDDAMAGE)
{
if(thisSprite._stateDone)
{
thisSprite._state = STATE_SHIELD;
}
}
else if(thisSprite._state == STATE_DAMAGE)
{
if(!thisSprite._airborne)
{
thisSprite._invincible = true;
}
if((thisSprite._atkdirX == ATKDIR_LEFT || thisSprite._atkdirX == ATKDIR_RIGHT || thisSprite._atkdirX == ATKDIR_BACK) && thisSprite._dashFuel > 0)
{
if(!thisSprite._airborne)
{
thisSprite.gotoAndPlay("fallen");
thisSprite._stateDone = true;
}
}
else if(thisSprite._stateDone && !thisSprite._airborne)
{
thisSprite._state = STATE_FALLEN;
thisSprite._fallTime = MAX_FALLTIME;
thisSprite.gotoAndPlay("fallen");
}
}
if(thisSprite._state == STATE_IDLE || thisSprite._state == STATE_RUN)
{
if(thisSprite._yspd == 1 && thisSprite._airborne)
{
thisSprite.gotoAndPlay("fall");
}
}
else if(thisSprite._state == STATE_WALL)
{
if(thisSprite._yspd == 1 && thisSprite._airborne)
{
thisSprite._state = STATE_RUN;
thisSprite.gotoAndPlay("fall");
}
}
thisSprite._x += thisSprite._xspd;
thisSprite._y += thisSprite._yspd;
thisSprite._yspd -= tempyspd;
if(tempyspd < 0 && thisSprite._yspd > 0)
{
thisSprite._yspd = 0;
}
tempyspd = 0;
if(thisSprite._hitDone)
{
thisSprite._hitDone = false;
damageDone[spriteIndex][otherIndex] = false;
}
if(thisSprite.projectile._visible)
{
if(thisName == NAME_BUBBLES)
{
if(thisSprite.projectile._xscale > 0)
{
thisSprite.projectile._x -= 5;
if(thisSprite.projectile._fast)
{
thisSprite.projectile._x -= 5;
}
}
else
{
thisSprite.projectile._x += 5;
if(thisSprite.projectile._fast)
{
thisSprite.projectile._x += 5;
}
}
}
else if(thisName == NAME_ROWDY && thisSprite.projectile._damage == BOOMER_DAMAGE)
{
if(thisSprite.projectile._xscale > 0)
{
thisSprite.projectile._x -= 12;
}
else
{
thisSprite.projectile._x += 12;
}
}
if(thisName == NAME_BUBBLES)
{
thisSprite.projectile._y += thisSprite.projectile._yspd;
}
if((thisSprite.projectile._x < -20 || thisSprite.projectile._x > 420 || thisSprite.projectile._y > 250) && !thisSprite.projectile._hitDone)
{
if(thisName != NAME_ROWDY)
{
thisSprite.projectile.gotoAndPlay("subside");
}
}
}
if(_autodeflect)
{
if(thisSprite._state == STATE_IDLE && !ai)
{
thisSprite._deflect = true;
}
if(otherSprite._state == STATE_IDLE && !otherai)
{
otherSprite._deflect = true;
}
}
if(otherName == NAME_ZIM && !otherSprite._vulnerable)
{
otherSprite._y -= ZIM_Y_OFFSET;
}
if(!(otherName == NAME_ZIM && otherSprite._state == STATE_RUN))
{
if(!((thisName == NAME_BELL || thisName == NAME_SHIRABELL) && thisSprite._state == STATE_AIRRANGED && thisSprite._dashFuel > 0))
{
if(thisSprite.atk || !thisSprite.projectile._hitDone || thisName == NAME_ZIM)
{
if(!thisSprite.projectile._hitDone && !otherSprite._invincible || thisName == NAME_ZIM)
{
if(thisSprite.projectile.atk.hitTest(otherSprite._x,otherSprite._y,true) && otherSprite._juggles < MAX_COMBO && thisName != NAME_ZIM || thisName == NAME_ZIM && thisSprite.zim.hitTest(otherSprite._x,otherSprite._y,false) && !thisSprite._vulnerable && otherSprite._state != STATE_DAMAGE && otherSprite._state != STATE_DASH)
{
if(thisName == NAME_BUBBLES)
{
thisSprite.projectile._x = otherSprite._x;
thisSprite.projectile._y = otherSprite._y;
thisSprite.projectile.gotoAndPlay("subside");
}
dmg = Math.round(thisSprite.projectile._damage * BASE_DAMAGE / 5);
if(otherSprite._deflect)
{
dmg = 0;
}
if(otherSprite._hp - dmg > MIN_HP && thisName != NAME_ZIM && ((otherSprite._state == STATE_SHIELD || otherSprite._state == STATE_SHIELDDAMAGE || otherSprite._deflect) && (otherSprite._xscale > 0 && thisSprite.projectile._xscale < 0 || otherSprite._xscale < 0 && thisSprite.projectile._xscale > 0) || otherai && (otherSprite._state == STATE_IDLE || otherSprite._state == STATE_RUN) && prob(otherSprite._ai_shield)))
{
if(!(otherSprite._xscale > 0 && thisSprite.projectile._xscale < 0 || otherSprite._xscale < 0 && thisSprite.projectile._xscale > 0))
{
otherSprite._xscale *= -1;
}
if(otherSprite._deflect)
{
if(otherSprite._yspd < -5)
{
otherSprite._yspd = -5;
}
otherSprite._state = STATE_SHIELD;
otherSprite.gotoAndPlay("shield");
otherSprite.combo.gotoAndPlay("deflected");
otherSprite._deflected = true;
otherSprite.combo._visible = true;
gotoAndPlay(2023);
}
else
{
otherSprite._state = STATE_SHIELDDAMAGE;
otherSprite.gotoAndPlay("shielddamage");
if(otherSprite._yspd < -5)
{
otherSprite._yspd = -5;
}
otherSprite._stateDone = false;
if(thisSprite.projectile._xscale > 0)
{
otherSprite._atkdirX = ATKDIR_LEFT;
}
else
{
otherSprite._atkdirX = ATKDIR_RIGHT;
}
if(ai)
{
thisSprite._ai_flank += thisSprite._ai_flankspd;
}
otherSprite._hp -= dmg;
if(thisSprite._personality == AI_AGGRESSIVE)
{
thisSprite._aggressiveRating += dmg;
}
else if(thisSprite._personality == AI_RANGED)
{
thisSprite._rangedRating += dmg;
}
if(otherSprite._personality == AI_AGGRESSIVE)
{
otherSprite._aggressiveRating -= dmg;
}
else if(otherSprite._personality == AI_RANGED)
{
otherSprite._rangedRating -= dmg;
}
}
}
else
{
dmg = thisSprite.projectile._damage * BASE_DAMAGE;
if(_gameMode == MODE_TUTORIAL)
{
dmg = 0;
}
if(otherName == NAME_SHIRABELL && (!otherai || _gameMode != MODE_STORY))
{
dmg = Math.round(dmg * 2);
}
else if(otherName == NAME_ZIM)
{
dmg = Math.round(dmg * 0.8);
}
else if(thisName == NAME_ZIM)
{
dmg = Math.round(dmg * (_difficulty / MAX_DIFFICULTY));
}
otherSprite._hp -= dmg;
if(thisSprite._personality == AI_AGGRESSIVE)
{
thisSprite._aggressiveRating += dmg;
}
else if(thisSprite._personality == AI_RANGED)
{
thisSprite._rangedRating += dmg;
}
if(otherSprite._personality == AI_AGGRESSIVE)
{
otherSprite._aggressiveRating -= dmg;
}
else if(otherSprite._personality == AI_RANGED)
{
otherSprite._rangedRating -= dmg;
}
if(otherName != NAME_ZIM)
{
otherSprite.gotoAndPlay("damage");
otherSprite._state = STATE_DAMAGE;
otherSprite._stateDone = false;
otherSprite._yspd = -15;
otherSprite._airborne = true;
if(thisSprite.projectile._xscale > 0)
{
otherSprite._atkdirX = ATKDIR_NONELEFT;
}
else
{
otherSprite._atkdirX = ATKDIR_NONERIGHT;
}
if(thisName == NAME_ROWDY)
{
otherSprite._yspd = -10;
if(thisSprite.projectile._xscale > 0)
{
otherSprite._atkdirX = ATKDIR_LEFT;
}
else
{
otherSprite._atkdirX = ATKDIR_RIGHT;
}
if(thisSprite.projectile._damage == BUTCH_DAMAGE)
{
otherSprite._yspd = -3;
if(thisSprite.projectile._xscale > 0)
{
otherSprite._atkdirX = ATKDIR_NONELEFT;
}
else
{
otherSprite._atkdirX = ATKDIR_NONERIGHT;
}
}
}
if(thisName == NAME_ZIM)
{
otherSprite._yspd = -5;
if(thisSprite._state == STATE_RUN)
{
if(!faceLeft)
{
otherSprite._atkdirX = ATKDIR_LEFT;
}
else
{
otherSprite._atkdirX = ATKDIR_RIGHT;
}
}
else if(faceLeft)
{
otherSprite._atkdirX = ATKDIR_LEFT;
}
else
{
otherSprite._atkdirX = ATKDIR_RIGHT;
}
}
otherSprite._atkdirY = ATKDIR_NONE;
if(thisName != NAME_ROWDY)
{
otherSprite._juggles += 0.8;
}
otherSprite._dashFuel = 15;
}
else if(otherSprite._recover)
{
otherSprite._hp += dmg;
}
else
{
otherSprite.zim.gotoAndPlay("damaged");
}
if(!otherSprite._recover)
{
effectHit[effectHitCounter]._x = otherSprite._x;
effectHit[effectHitCounter]._y = otherSprite._y;
effectHit[effectHitCounter]._rotation = Math.random() * 360;
effectHit[effectHitCounter].gotoAndPlay(1);
effectHit[effectHitCounter]._visible = true;
effectHitCounter = (effectHitCounter + 1) % MAX_HITEFFECTS;
thisSprite.combo.num = thisSprite.combo.num + 1;
if(thisSprite.combo.num > 1)
{
thisSprite.combo.gotoAndPlay(1);
thisSprite.combo._visible = true;
}
}
}
}
else if(thisSprite.projectile._visible && otherSprite.projectile._visible && !thisSprite.projectile._hitDone && !otherSprite.projectile._hitDone && thisSprite.projectile.atk.hitTest(otherSprite.projectile))
{
if(thisName == NAME_BUBBLES && otherName == NAME_BUBBLES)
{
thisSprite.projectile.gotoAndPlay("subside");
otherSprite.projectile.gotoAndPlay("subside");
}
}
}
if(!otherSprite._invincible && !damageDone[spriteIndex][otherIndex] && (thisSprite.atk.hitTest(otherSprite._x,otherSprite._y,true) || otherName == NAME_ZIM && !otherSprite._vulnerable && thisSprite._airborne && thisSprite.atk.hitTest(otherSprite._x,otherSprite._y + ZIM_Y_OFFSET2,true)) && otherSprite._juggles < MAX_COMBO)
{
dmg = Math.round(thisSprite._damage * BASE_DAMAGE / 5);
if(otherSprite._deflect)
{
dmg = 0;
}
if(otherSprite._hp - dmg > MIN_HP && ((otherSprite._state == STATE_SHIELD || otherSprite._state == STATE_SHIELDDAMAGE || otherSprite._deflect) && (otherSprite._xscale > 0 && (thisSprite._atkdirX == ATKDIR_RIGHT || thisSprite._atkdirX == ATKDIR_NONERIGHT || otherSprite._x >= thisSprite._x && thisSprite._atkdirX == ATKDIR_VACUUM) || otherSprite._xscale < 0 && (thisSprite._atkdirX == ATKDIR_LEFT || thisSprite._atkdirX == ATKDIR_NONELEFT || otherSprite._x <= thisSprite._x && thisSprite._atkdirX == ATKDIR_VACUUM)) || otherai && (otherSprite._state == STATE_IDLE || otherSprite._state == STATE_RUN) && prob(otherSprite._ai_shield)))
{
if(!(otherSprite._xscale > 0 && (thisSprite._atkdirX == ATKDIR_RIGHT || thisSprite._atkdirX == ATKDIR_NONERIGHT || otherSprite._x >= thisSprite._x && thisSprite._atkdirX == ATKDIR_VACUUM) || otherSprite._xscale < 0 && (thisSprite._atkdirX == ATKDIR_LEFT || thisSprite._atkdirX == ATKDIR_NONELEFT || otherSprite._x <= thisSprite._x && thisSprite._atkdirX == ATKDIR_VACUUM)))
{
otherSprite._xscale *= -1;
}
if(otherSprite._deflect)
{
if(otherSprite._yspd < -5)
{
otherSprite._yspd = -5;
}
otherSprite._state = STATE_SHIELD;
otherSprite.gotoAndPlay("shield");
otherSprite.combo.gotoAndPlay("deflected");
otherSprite._deflected = true;
otherSprite.combo._visible = true;
gotoAndPlay(2023);
}
else
{
otherSprite._state = STATE_SHIELDDAMAGE;
otherSprite.gotoAndPlay("shielddamage");
if(otherSprite._yspd < -5)
{
otherSprite._yspd = -5;
}
otherSprite._stateDone = false;
otherSprite._atkdirX = thisSprite._atkdirX;
if(ai)
{
thisSprite._ai_flank += thisSprite._ai_flankspd;
}
if(thisSprite._state == STATE_COMBO1 || thisSprite._state == STATE_COMBO2)
{
dmg = 0;
}
otherSprite._hp -= dmg;
if(thisSprite._personality == AI_AGGRESSIVE)
{
thisSprite._aggressiveRating += dmg;
}
else if(thisSprite._personality == AI_RANGED)
{
thisSprite._rangedRating += dmg;
}
if(otherSprite._personality == AI_AGGRESSIVE)
{
otherSprite._aggressiveRating -= dmg;
}
else if(otherSprite._personality == AI_RANGED)
{
otherSprite._rangedRating -= dmg;
}
}
}
else if(otherSprite._hp - thisSprite._damage * BASE_DAMAGE > MIN_HP && (thisName == NAME_BLOSSOM && (thisSprite._state == STATE_RANGED || thisSprite._state == STATE_AIRRANGED)))
{
if(otherSprite._state != STATE_FROZEN && otherName != NAME_ZIM)
{
otherSprite.gotoAndPlay("frozen");
otherSprite._state = STATE_FROZEN;
otherSprite._stateDone = false;
if(otherSprite._yspd < -5)
{
otherSprite._yspd = -5;
}
dmg = thisSprite._damage * BASE_DAMAGE;
if(_gameMode == MODE_TUTORIAL)
{
dmg = 0;
}
otherSprite._hp -= dmg;
if(thisSprite._personality == AI_AGGRESSIVE)
{
thisSprite._aggressiveRating += dmg;
}
else if(thisSprite._personality == AI_RANGED)
{
thisSprite._rangedRating += dmg;
}
if(otherSprite._personality == AI_AGGRESSIVE)
{
otherSprite._aggressiveRating -= dmg;
}
else if(otherSprite._personality == AI_RANGED)
{
otherSprite._rangedRating -= dmg;
}
otherSprite._atkdirX = thisSprite._atkdirX;
otherSprite._atkdirY = thisSprite._atkdirY;
if(otherSprite._yspd > -5)
{
otherSprite._yspd = -5;
}
otherSprite._airborne = true;
otherSprite._dashFuel = 15;
thisSprite.combo.num = thisSprite.combo.num + 1;
if(thisSprite.combo.num > 1)
{
thisSprite.combo.gotoAndPlay(1);
thisSprite.combo._visible = true;
}
}
}
else
{
if(otherName != NAME_ZIM)
{
otherSprite.gotoAndPlay("damage");
otherSprite._state = STATE_DAMAGE;
otherSprite._stateDone = false;
if(otherSprite._yspd < -5 && thisSprite._atkdirY != ATKDIR_BOUNCE)
{
otherSprite._yspd = -5;
}
if(thisSprite._weakHit)
{
if(thisSprite._state != STATE_AIRRANGED)
{
if(thisName == NAME_BUTTERCUP && (thisSprite._state == STATE_COMBO3B || thisSprite._state == STATE_RANGED) || (thisName == NAME_BELL || thisName == NAME_SHIRABELL) && thisSprite._state == STATE_RANGED)
{
otherSprite._atkdirX = thisSprite._atkdirX;
}
else if(thisSprite._atkdirX == ATKDIR_LEFT)
{
otherSprite._atkdirX = ATKDIR_NONELEFT;
}
else if(thisSprite._atkdirX == ATKDIR_RIGHT)
{
otherSprite._atkdirX = ATKDIR_NONERIGHT;
}
else
{
otherSprite._atkdirX = thisSprite._atkdirX;
}
}
else
{
otherSprite._atkdirX = thisSprite._atkdirX;
}
otherSprite._atkdirY = thisSprite._atkdirY;
if((thisName == NAME_BELL || thisName == NAME_SHIRABELL) && thisSprite._state == STATE_COMBO3)
{
otherSprite._atkdirY = ATKDIR_NONE;
}
otherSprite._airborne = true;
if(thisName == NAME_BUTTERCUP && thisSprite._state == STATE_COMBO2)
{
otherSprite._juggles += 0.8;
}
}
else
{
otherSprite._atkdirX = thisSprite._atkdirX;
otherSprite._atkdirY = thisSprite._atkdirY;
otherSprite._juggles = otherSprite._juggles + 1;
}
if(otherSprite._atkdirY == ATKDIR_JUGGLE)
{
if(otherSprite._yspd > -20)
{
otherSprite._yspd = -20;
}
otherSprite._airborne = true;
}
else if(otherSprite._atkdirY == ATKDIR_UP)
{
if(otherSprite._yspd > -15)
{
otherSprite._yspd = -15;
}
otherSprite._airborne = true;
}
else if(otherSprite._atkdirY == ATKDIR_BOUNCE)
{
if(otherSprite._y < 60)
{
if(otherSprite._yspd > -11 + otherSprite._y / 12)
{
otherSprite._yspd = Math.floor(-11 + otherSprite._y / 12);
}
}
else if(otherSprite._yspd > -11)
{
otherSprite._yspd = -11;
}
otherSprite._airborne = true;
}
else if(otherSprite._atkdirY == ATKDIR_DOWN)
{
if(otherSprite._y < 180)
{
if(otherSprite._yspd > 0)
{
otherSprite._yspd = 0;
}
}
else if(otherSprite._yspd > -3)
{
otherSprite._yspd = -3;
}
otherSprite._airborne = true;
}
else if(otherSprite._atkdirY == ATKDIR_NONE)
{
if(otherSprite._yspd > -5)
{
otherSprite._yspd = -5;
}
otherSprite._airborne = true;
}
otherSprite._dashFuel = 15;
}
else if(otherSprite._recover)
{
otherSprite._hp += dmg;
}
else
{
otherSprite.zim.gotoAndPlay("damaged");
if(thisSprite._state == STATE_DOWNATK)
{
otherSprite._armour--;
}
}
if(!otherSprite._recover)
{
effectHit[effectHitCounter]._x = otherSprite._x;
effectHit[effectHitCounter]._y = otherSprite._y;
effectHit[effectHitCounter]._rotation = Math.random() * 360;
effectHit[effectHitCounter].gotoAndPlay(1);
effectHit[effectHitCounter]._visible = true;
effectHitCounter = (effectHitCounter + 1) % MAX_HITEFFECTS;
thisSprite.combo.num = thisSprite.combo.num + 1;
if(thisSprite.combo.num > 1)
{
thisSprite.combo.gotoAndPlay(1);
thisSprite.combo._visible = true;
}
}
dmg = thisSprite._damage * BASE_DAMAGE;
if(_gameMode == MODE_TUTORIAL)
{
dmg = 0;
}
if(otherName == NAME_SHIRABELL && (!otherai || _gameMode != MODE_STORY))
{
dmg = Math.round(dmg * 2);
}
else if(otherName == NAME_ZIM)
{
dmg = Math.round(dmg * 0.8);
}
else if(thisName == NAME_ZIM)
{
dmg = Math.round(dmg * (_difficulty / MAX_DIFFICULTY));
}
otherSprite._hp -= dmg;
if(thisSprite._personality == AI_AGGRESSIVE)
{
thisSprite._aggressiveRating += dmg;
}
else if(thisSprite._personality == AI_RANGED)
{
thisSprite._rangedRating += dmg;
}
if(otherSprite._personality == AI_AGGRESSIVE)
{
otherSprite._aggressiveRating -= dmg;
}
else if(otherSprite._personality == AI_RANGED)
{
otherSprite._rangedRating -= dmg;
}
}
damageDone[spriteIndex][otherIndex] = true;
}
if(!otherSprite.projectile._hitDone && otherSprite.projectile._visible && thisSprite.atk.hitTest(otherSprite.projectile._x,otherSprite.projectile._y,true) && (thisSprite._state == STATE_RANGED || (thisSprite._state == STATE_COMBO3B && thisName == NAME_BUTTERCUP)(thisSprite._state == STATE_COMBO3 && (thisName == NAME_BLOSSOM || thisName == NAME_BUBBLES))))
{
if(otherName == NAME_BUBBLES)
{
otherSprite.projectile.gotoAndPlay("subside");
}
}
}
}
}
if(otherName == NAME_ZIM && !otherSprite._vulnerable)
{
otherSprite._y += ZIM_Y_OFFSET;
}
if(_autodeflect)
{
if(thisSprite._state == STATE_IDLE && !ai)
{
thisSprite._deflect = false;
thisSprite._deflected = false;
thisSprite._deflectwait = false;
}
if(otherSprite._state == STATE_IDLE && !otherai)
{
otherSprite._deflect = false;
otherSprite._deflected = false;
otherSprite._deflectwait = false;
}
}
spriteIndex++;
}
if(_scroll)
{
chgtx = sprite[0]._x - SCREENSIZE_HALFWIDTH;
chgty = sprite[0]._y - 50;
chgtx = (chgtx + sprite[1]._x - SCREENSIZE_HALFWIDTH) / 2;
chgty = Math.min(chgty,sprite[1]._y - 50);
if(spriteName[1] == NAME_ZIM)
{
chgtx = 0;
}
chgtx = Math.round(chgtx / 3);
chgty = Math.round(chgty / 3);
if(terrain._x - chgtx > -10)
{
chgtx = terrain._x + 10;
}
if(terrain._x - chgtx < -250)
{
chgtx = terrain._x + 250;
}
if(terrain._y - chgty < -245)
{
chgty = terrain._y + 245;
}
if(terrain._y - chgty > -130)
{
chgty = terrain._y + 130;
}
terrain._x -= chgtx;
terrain._y -= chgty;
fg1._x -= chgtx * 2;
fg1._y -= chgty * 2;
fg2._x -= chgtx * 2;
fg2._y -= chgty * 2;
spriteIndex = 0;
while(spriteIndex < _spriteInstances)
{
sprite[spriteIndex]._x -= chgtx;
sprite[spriteIndex]._y -= chgty;
if(!sprite[spriteIndex].projectile._hitDone)
{
sprite[spriteIndex].projectile._x -= chgtx;
sprite[spriteIndex].projectile._y -= chgty;
}
spriteIndex++;
}
opaque._x = terrain._x;
opaque._y = terrain._y;
}
sprite[0]._hp = Math.max(sprite[0]._hp,MIN_HP);
sprite[1]._hp = Math.max(sprite[1]._hp,MIN_HP);
hpbar0.hid._width = 200 - sprite[0]._hp / 5;
hpbar0.cur._x = 100 + sprite[0]._hp / 10;
hpbar1.hid._width = 200 - sprite[1]._hp / 5;
hpbar1.cur._x = 100 + sprite[1]._hp / 10;
if(sprite[0]._dashes < 300)
{
sprite[0]._dashes = sprite[0]._dashes + 1;
}
if(sprite[1]._dashes < 300)
{
sprite[1]._dashes = sprite[1]._dashes + 1;
}
dashbarframe0.dashbar._xscale = Math.min(100 - sprite[0]._dashes / 3,100);
dashbarframe1.dashbar._xscale = Math.min(100 - sprite[1]._dashes / 3,100);
spriteIndex = 0;
while(spriteIndex < _spriteInstances)
{
if(sprite[spriteIndex]._invincible && sprite[spriteIndex]._state != STATE_HIT && sprite[spriteIndex]._state != STATE_DAMAGE && sprite[spriteIndex]._state != STATE_DASH && sprite[spriteIndex]._state != STATE_FALLEN && sprite[spriteIndex]._state != STATE_RECOVER)
{
if(sprite[spriteIndex]._invincibleWait)
{
sprite[spriteIndex]._invincible = false;
sprite[spriteIndex]._invincibleWait = false;
thisSprite._juggles = 0;
}
sprite[spriteIndex]._invincibleWait = true;
}
if(sprite[spriteIndex]._x < 0)
{
sprite[spriteIndex]._x = 11;
}
if(sprite[spriteIndex]._x > 400)
{
sprite[spriteIndex]._x = 389;
}
if(sprite[spriteIndex]._y - (terrain._y + 245) > 260)
{
sprite[spriteIndex]._y = 203;
}
if(sprite[spriteIndex]._y < -100 && sprite[spriteIndex]._yspd < 0)
{
sprite[spriteIndex]._yspd = 0;
sprite[spriteIndex]._y = 0;
trace("Houston, we have a problem.");
}
spriteIndex++;
}
if(sprite[0]._hp <= MIN_HP || sprite[1]._hp <= MIN_HP)
{
if(!_gameover)
{
_gameover = true;
readyfight.removeMovieClip();
winFlash.play();
winFlash.colour = new Color(winFlash);
effectHit[MAX_HITEFFECTS]._visible = true;
if(sprite[0]._hp <= MIN_HP)
{
sprite[1].combo._finish = true;
if(sprite[1].combo.num > 1)
{
sprite[1].combo.gotoAndPlay(1);
}
winFlash.colour.setTransform(winClrTrans[spriteName[1]]);
effectHit[MAX_HITEFFECTS]._x = sprite[0]._x;
effectHit[MAX_HITEFFECTS]._y = sprite[0]._y;
}
else
{
sprite[0].combo._finish = true;
if(sprite[0].combo.num > 1)
{
sprite[0].combo.gotoAndPlay(1);
}
winFlash.colour.setTransform(winClrTrans[spriteName[0]]);
effectHit[MAX_HITEFFECTS]._x = sprite[1]._x;
effectHit[MAX_HITEFFECTS]._y = sprite[1]._y;
}
effectHit[MAX_HITEFFECTS]._visible = true;
effectHit[MAX_HITEFFECTS].gotoAndPlay(1);
gotoAndPlay(2033);
}
}
if((sprite[0]._hp <= MIN_HP || sprite[1]._hp <= MIN_HP) && (!sprite[0].projectile._visible && !sprite[1].projectile._visible) && !sprite[0]._airborne && !sprite[1]._airborne && (sprite[0]._state == STATE_IDLE || sprite[1]._state == STATE_IDLE || sprite[0]._state == STATE_RUN || sprite[1]._state == STATE_RUN || sprite[0]._hp <= MIN_HP && sprite[1]._hp <= MIN_HP))
{
if(sprite[0]._hp > MIN_HP)
{
if(sprite[0]._state == STATE_RUN)
{
sprite[0].gotoAndPlay("idle");
}
sprite[0]._state = STATE_IDLE;
if(spriteName[0] == NAME_DEXTER)
{
if(sprite[0]._xscale > 0 && sprite[0]._x < sprite[1]._x || sprite[0]._xscale < 0 && sprite[0]._x > sprite[1]._x)
{
sprite[0]._xscale *= -1;
}
if(sprite[0]._xscale > 0 && sprite[0]._x > 360 || sprite[0]._xscale < 0 && sprite[0]._x < 40)
{
sprite[0]._xscale *= -1;
}
}
}
if(sprite[1]._hp > MIN_HP)
{
if(sprite[1]._state == STATE_RUN)
{
sprite[1].gotoAndPlay("idle");
}
sprite[1]._state = STATE_IDLE;
if(spriteName[1] == NAME_DEXTER)
{
if(sprite[1]._xscale > 0 && sprite[1]._x < sprite[0]._x || sprite[1]._xscale < 0 && sprite[1]._x > sprite[0]._x)
{
sprite[1]._xscale *= -1;
}
if(sprite[1]._xscale > 0 && sprite[1]._x > 360 || sprite[1]._xscale < 0 && sprite[1]._x < 40)
{
sprite[1]._xscale *= -1;
}
}
}
gotoAndPlay(2037);
}
else if(_gameover && (sprite[0]._hp <= MIN_HP || sprite[1]._hp <= MIN_HP))
{
if(winFlash._currentframe != 1)
{
gotoAndPlay(2018);
}
}
if(_returntomenu)
{
stopAllSounds();
removeAllClips();
gotoAndPlay(1226);
}
else if(_paused)
{
gotoAndPlay(2015);
}
if(sprite[0]._deflected)
{
sprite[0]._aideflected = true;
}
if(!sprite[0]._deflect)
{
sprite[0]._deflected = false;
}
else if(sprite[0]._deflectwait)
{
sprite[0]._deflectwait = false;
}
else
{
sprite[0]._deflect = false;
}
if(sprite[1]._deflected)
{
sprite[1]._aideflected = true;
sprite[1]._state = STATE_SHIELD;
sprite[1].gotoAndPlay("shield");
}
if(!sprite[1]._deflect)
{
sprite[1]._deflected = false;
}
else if(sprite[1]._deflectwait)
{
sprite[1]._deflectwait = false;
}
else
{
sprite[1]._deflect = false;
}